// Copyright (c) 2010 Manuel Peinado Gallego <manuel.peinado@gmail.com>
// Distributed under the MIT license


#include <alg3d/alg3d.h>

namespace
{
gx::Mat3& (gx::Mat3::*mat3RotFunc1)(const gx::Vec3&) = &gx::Mat3::make_rot;
gx::Mat3& (gx::Mat3::*mat3RotFunc2)(const gx::AxisAngle&) = &gx::Mat3::make_rot;
    
gx::Mat3& (gx::Mat3::*mat3ScaleFunc1)(double) = &gx::Mat3::make_scale;
gx::Mat3& (gx::Mat3::*mat3ScaleFunc2)(const gx::Vec3&) = &gx::Mat3::make_scale;

gx::Mat3& mat3EyeFunc(gx::Mat3& m)
{
    m = gx::Mat3(gx::eye);
    return m;
}
}


void pyInitAlg3d()
{
    // It is important  to use self_ns below. See this:
    // http://mail.python.org/pipermail/cplusplus-sig/2005-February/008295.html

    bpy::class_<gx::Vec3>("Vec3", bpy::init<>())
        .def(bpy::init<double, double, double>())
        .def(bpy::self + bpy::self)
        .def(bpy::self_ns::str(bpy::self))
    ;

    bpy::class_<gx::AxisAngle>("AxisAngle")
        .def(bpy::init<gx::Vec3, double>())
    ;

    //bpy::class_<gx::Mat3>("Mat3", bpy::init<>())
    //    .def(bpy::self_ns::str(bpy::self))
    //    .def(bpy::self * bpy::self)
    //    .def(bpy::self * gx::Vec3())
    //    .def("makeId", &mat3EyeFunc, bpy::return_internal_reference<>())
    //    .def("makeRot", mat3RotFunc1, bpy::return_internal_reference<>())
    //    .def("makeRot", mat3RotFunc2, bpy::return_internal_reference<>())
    //    .def("makeScale", mat3ScaleFunc1, bpy::return_internal_reference<>())
    //    .def("makeScale", mat3ScaleFunc2, bpy::return_internal_reference<>())
    //;

}
